using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using DSEngine.Core;
using DSEngine.Stage;

namespace DSEngine.Sprite
{
    public class SpTexture : IDisposable
    {
        public static SpTexture Create(Layout layout,string contentName)
        {
            return new SpTexture(layout.Content.Load<Texture2D>(contentName));
        }
        public static SpTexture Create(int width, int height)
        {
            return new SpTexture(width, height);
        }
        public static SpTexture Create(Texture2D tex)
        {
            return new SpTexture(tex);
        }
        Texture2D texture;
        public SpTexture(Texture2D tex)
        {
            texture = tex;
            this.Width = texture.Width;
            this.Height = texture.Height;
        }
        public SpTexture(int width, int height)
        {
            RenderTarget2D tex = new RenderTarget2D(DSEngine.Instance.GameInstance.GraphicsDevice, width, height);
            texture = tex;
        }
        public Texture2D Texture { get { return texture; } }
        public float Width { get; set; }
        public float Height { get; set; }

        public void Dispose()
        {
            Texture.Dispose();
        }
    }
}
